package com.proj.hot.widget;

import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;

/**
 * 重新定义PagerScroller，用于改变viewpager的滑动速度
 */
public class PagerScroller extends Scroller{

    private int mDuration = 1500;

    public PagerScroller(Context context)
    {
        super(context);
    }

    public PagerScroller(Context context, Interpolator interpolator)
    {
        super(context, interpolator);
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy, int duration)
    {
        super.startScroll(startX, startY, dx, dy, mDuration);
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy)
    {
        super.startScroll(startX, startY, dx, dy, mDuration);
    }

    /**
     * set animation time
     *
     * @param time
     */
    public void setmDuration(int time)
    {
        mDuration = time;
    }

    /**
     * get current animation time
     *
     * @return
     */
    public int getmDuration()
    {
        return mDuration;
    }

}
